<%@page import="java.util.Date"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="com.mongodb.DBObject"%>
<%@page import="com.mongodb.DBCursor"%>
<%
String work = (String)session.getAttribute("work");
DBCursor cursor=(DBCursor)request.getAttribute("cursor");
String[] listError = (String[]) request.getAttribute("listError");
String success = (String)request.getAttribute("success");
String post = (String)request.getAttribute("post");
ArrayList<String> category = (ArrayList<String>) request.getAttribute("category");
DBObject object = (DBObject)request.getAttribute("object");
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=utf-8");
response.setCharacterEncoding("utf-8");
%>
<%@ page language="java" import="java.util.Enumeration"
	pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="Get Special content" />
	<jsp:param name="description" value="" />
	<jsp:param name="keywords" value="" />
	<jsp:param name="page" value="home" />
</jsp:include>			
		<div id="content">
        	<div id="content_inner">
            	<div id="maincontent">
                    <div id="getautocontent">
                        <h2 class="title">Get Special content</h2>
                        <div>
                            <div class="left">
                                <ul class="option">
                                    <li><a href="/get-auto-content" >Get Auto Content</a></li>
                                    <li><a href="#getspecialcontent" id="check-content">Get Special Content</a></li>
                                    <li><a href="/profile">Change password</a></li>
                                    <li><a href="/list-source">Manager source</a></li>
                                    <li><a href="/logout">Logout</a></li>
                                </ul>
                            </div>
                            <div class="right">
                                <div class="listlink">
                                    <h2 class="title">List source</h2>
                                    <ul>
                                    	<%
                                    	if(cursor.size()>0)
                                    	{
                                    		while(cursor.hasNext())
                                    		{
                                    			DBObject dbObject = cursor.next();
                                    	%>                                    
                                        	<li><a style="background-image: url('https://s2.googleusercontent.com/s2/favicons?domain_url=<%=dbObject.get("sitemap") %>');" href="/edit-url?url=<%=URLEncoder.encode(dbObject.get("sitemap").toString())%>"><%=dbObject.get("sitemap") %></a></li>
                                        <%
                                    		}
                                    	} else {
                                        %>      
                                        <li>You have no source. <a href="#formgetcontent" style="display: inline;">Click here</a></li>
                                        <%
                                    	}
                                        %>                          
                                    </ul>
                                </div>                            
                            </div>
                            <div class="clearbreak"></div>
                        </div>                                        
                        <div id="getspecialcontent">
                            <h2 class="title">Blog  ( <span style="color: #D54E21"><%=work %></span> )</h2>
                            <div id="userform">
                                <form method="post" action="" accept-charset="UTF-8">
                                	<%
                                	if(success!=null)
                                	{
                                	%>
                                	<div style="border: 1px solid #CCCCCC;border-radius: 3px 3px 3px 3px;margin-bottom: 20px;padding: 10px;background: #525252;color: #FFF;font-weight: bold;">
                                		<%=success %>
                                	</div>
                                	<%
                                	}
                                	%>
                                    <div>
                                        <label>
                                            <span class="tooltips icon-help2">
                                                The Link to get special content
                                                <span>
                                                   Add the URL that you want to get content.<br />
                                                   (Example : http://iptips.org/2012/05/31/new-improved-mac-app-interfaces-for-osx/)
                                                </span>
                                            </span>
                                            ( <a href="javascript:void(0)" id="checkreg">Older Selector</a> )
                                            <br />
                                            <input class="input" type="text" name="sitemap" id="sitemap" value="<%=request.getAttribute("sitemap")!=null?request.getAttribute("sitemap"):""%>"/>
                                            <%=listError[0]!=null?"<div class=\"error\">"+listError[0]+"</div>":"" %>
                                            <%=listError[4]!=null?"<div class=\"error\">"+listError[4]+"</div>":"" %>
                                        </label>
                                    </div>
                                    <div style="border: 1px solid #CCC;margin-bottom: 10px;padding: 5px;max-height: 93px;overflow: auto;width: 96%;display: none;" id='showreg'></div>                                                                       
                                                                                                           
                                    <div>
                                        <label>
                                           <span class="tooltips icon-help2">
                                                Title Selector
                                                <span>
                                                    Type the selector to get the title of the article.<br /> (Example : ".title")
                                                </span>
                                                
                                            </span>
                                            <br />
                                            <input class="input" type="text" name="regtitle" id="regtitle" value="<%=request.getAttribute("regtitle")!=null?request.getAttribute("regtitle"):""%>"/>
                                            <%=listError[2]!=null?"<div class=\"error\">"+listError[2]+"</div>":"" %>
                                        </label>
                                    </div>
                                    <div>
                                       <label>
                                           <span class="tooltips icon-help2">
                                                Content Selector
                                                <span>
                                                    Type the selector to get the content of the article. <br /> (Example : ".content")
                                                </span>                                                
                                           </span>
                                           <br />
                                           <input class="input" type="text" name="regcontent" id="regcontent" value="<%=request.getAttribute("regcontent")!=null?request.getAttribute("regcontent"):""%>"/>
                                           <%=listError[3]!=null?"<div class=\"error\">"+listError[3]+"</div>":"" %>
                                       </label>
                                    </div>
                                    <div>
                                        <label>
                                            <span class="tooltips icon-help2">
                                                Remove Selector 
                                                <span>
                                                    Type the selector to remove the tags or the part of content that you don't want to get. <br /> (Example : "script .addthis_toolbox textarea" )
                                                </span>
                                                
                                            </span>
                                            <br />
                                            <input class="input" type="text" name="regremove" id="regremove" value="<%=request.getAttribute("regremove")!=null?request.getAttribute("regremove"):""%>"/>
                                        </label>
                                    </div>
                                    <a href="javascript:void(0)" id='openchoise'><span class="icon-arrow-right1">More options</span></a>
                                    <div id='advance'>
                                    	<div>
                                    		<div class="clearafter addtext">
			                                    <div>
			                                        <label>
			                                            <span class="tooltips icon-help2">
			                                                Add prefix to the title
			                                                <span>
			                                                    Type the prefix that you want to add to the post's title.
			                                                    <br />
			                                                    Example : "Hatforrent - ".
			                                                    <br />
			                                                    Output : "Hatforrent - the post's title".
			                                                </span>	                                                
			                                            </span>
			                                            <br />
			                                            <input class="input" type="text" name="sumtitlebefore" id="sumtitlebefore" value="<%=request.getAttribute("sumtitlebefore")!=null?request.getAttribute("sumtitlebefore"):""%>"/>
			                                        </label>
			                                    </div>
			                                    <div>
			                                        <label>
			                                            <span class="tooltips icon-help2">
			                                                Add suffix to the title
			                                                <span>
			                                                    Type the suffix that you want to add to the post's title.
			                                                    <br />
			                                                    Example : " - Hatforrent".
			                                                    <br />
			                                                    Output : "the post's title - Hatforrent".
			                                                </span>	                                                
			                                            </span>
			                                            <br />
			                                            <input class="input" type="text" name="sumtitleafter" id="sumtitleafter" value="<%=request.getAttribute("sumtitleafter")!=null?request.getAttribute("sumtitleafter"):""%>"/>
			                                        </label>
			                                    </div>
		                                    </div>
		                                    <div class="checkbox-group clearafter">
		                                    	<div style="display: none;">
		                                            <span class="tooltips">
		                                                Sitemap type : <img src="images/help.png" />
		                                                <span>
		                                                    Content contain Html or Rss. Best to choose Html.
		                                                </span>
		                                            </span>
		                                            <label>Html<input class="input type" type="radio" name="type" value="html" <%=(request.getAttribute("type")!=null&&request.getAttribute("type").equals("html"))?"checked=\"checked\"":""%> <%=request.getAttribute("type")==null?"checked=\"checked\"":"" %>/></label>
		                                            <label>Rss<input class="input type" type="radio" name="type" value="rss" <%=(request.getAttribute("type")!=null&&request.getAttribute("type").equals("rss"))?"checked=\"checked\"":""%>/></label>
		                                        </div>
		                                        <div class="col-1">
		                                        	<div>
			                                        	<h3 class="title clearafter">
			                                        		Link
			                                        		<span class="tooltips icon-note">			                                                
				                                                <span>
				                                                    Set type of the link is follow or nofollow.<br /> (default is nofollow)
				                                                </span>
				                                            </span>
			                                        	</h3>
			                                        	<div class="clearafter">
				                                            <label class="col-1"><input class="input type" type="radio" name="typeLink" value="nofollow" <%=(request.getAttribute("typeLink")!=null&&request.getAttribute("typeLink").equals("nofollow"))?"checked=\"checked\"":""%> <%=request.getAttribute("typeLink")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;Nofollow</label>
				                                            <label class="col-2"><input class="input type" type="radio" name="typeLink" value="dofollow" <%=(request.getAttribute("typeLink")!=null&&request.getAttribute("typeLink").equals("dofollow"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;Follow</label>
		                                            	</div>
		                                            </div>
		                                        </div>
		                                        <div class="col-2">
		                                        	<div>
		                                        		<h3 class="title clearafter">
		                                        			Source
		                                        			<span class="tooltips icon-note">
				                                                <span>
				                                                    Choose yes if you want to display the source. it will be displayed at the bottom of the article.<br /> (default is yes)
				                                                </span>
				                                            </span>
		                                        		</h3>
		                                        		<div class="clearafter">
				                                            <label class="col-1"><input class="input type" type="radio" name="source" value="yes" <%=(request.getAttribute("source")!=null&&request.getAttribute("source").equals("yes"))?"checked=\"checked\"":""%> <%=request.getAttribute("source")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;Yes</label>
				                                            <label class="col-2"><input class="input type" type="radio" name="source" value="no" <%=(request.getAttribute("source")!=null&&request.getAttribute("source").equals("no"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;No</label>
		                                        		</div>
		                                        	</div>
		                                        </div>
		                                        <div class="col-3">
		                                        	<div>
		                                        		<h3 class="title clearafter">
		                                        			Source Type
		                                        			<span class="tooltips icon-note">			                                                
				                                                <span>
				                                                    The format of source when display.<br /> (display as Text or Link)
				                                                </span>
				                                            </span>
		                                        		</h3>
														<div class="clearafter">
															<label class="col-1"><input class="input type" type="radio" name="source_type" value="text" <%=(request.getAttribute("source_type")!=null&&request.getAttribute("source_type").equals("text"))?"checked=\"checked\"":""%> <%=request.getAttribute("source_type")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;Text</label>
			                                            	<label class="col-2"><input class="input type" type="radio" name="source_type" value="link" <%=(request.getAttribute("source_type")!=null&&request.getAttribute("source_type").equals("link"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;Link</label>
														</div>		                                            
		                                        	</div>
		                                        </div>	 
		                                        <div class="col-1">
		                                        	<div>
		                                        		<h3 class="title clearafter">
		                                        			Source Image
		                                        			<span class="tooltips icon-note">			                                                
				                                                <span>
				                                                    The place to store images.
				                                                    <br />
				                                                    Source : keep the original image source.
				                                                    <br />
				                                                    CDN : images will be stored at google.
				                                                </span>
				                                            </span>
		                                        		</h3>
														<div class="clearafter">
															<label class="col-1"><input class="input type" type="radio" name="source_image" value="source" <%=(request.getAttribute("source_image")!=null&&request.getAttribute("source_image").equals("source"))?"checked=\"checked\"":""%> <%=request.getAttribute("source_image")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;Source</label>
			                                            	<label class="col-2"><input class="input type" type="radio" name="source_image" value="cdn" <%=(request.getAttribute("source_image")!=null&&request.getAttribute("source_image").equals("cdn"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;CDN</label>
														</div>		                                            
		                                        	</div>
		                                        </div>
		                                        <div class="col-2">
			                                        	<div>
			                                        		<h3 class="title clearafter">
			                                        			Remove tag a
			                                        			<span class="tooltips icon-note">			                                                
					                                                <span>
					                                                    Remove tag a in article
					                                                </span>
					                                            </span>
			                                        		</h3>
															<div class="clearafter">
																<label class="col-1"><input class="input type" type="radio" name="remove_tag_a" value="no" <%=(request.getAttribute("remove_tag_a")!=null&&request.getAttribute("remove_tag_a").equals("no"))?"checked=\"checked\"":""%> <%=request.getAttribute("source_image")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;No</label>
				                                            	<label class="col-2"><input class="input type" type="radio" name="remove_tag_a" value="yes" <%=(request.getAttribute("remove_tag_a")!=null&&request.getAttribute("remove_tag_a").equals("yes"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;Yes</label>
															</div>		                                            
			                                        	</div>
			                                        </div>                                       
		                                    </div>                                                                       
		                                    <div id="new-feature" class="clearafter" style="display: none;">
		                                    	<div>
		                                    		<div>
		                                    			<div class="checkbox-group clearafter">
		                                    				<div>
		                                    					<div>
				                                    				<h3 class="title">Translate</h3>
				                                    				<div class="clearafter">
				                                    					<label class="col-1"><input class="input type translate" type="radio" name="translate" value="no" <%=(request.getAttribute("translate")!=null&&request.getAttribute("translate").equals("no"))?"checked=\"checked\"":""%> <%=request.getAttribute("translate")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;No</label>
					                                            		<label class="col-2"><input class="input type translate" type="radio" name="translate" value="yes" <%=(request.getAttribute("translate")!=null&&request.getAttribute("translate").equals("yes"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;Yes</label>
				                                    				</div>
			                                    				</div>
		                                    				</div>
		                                    				<select name="language" id='language' disabled="disabled">
				                                            	<option value="en">English</option>
				                                            	<option value="es">Spanish</option>
				                                            	<option value="ja">Japan</option>
				                                            	<option value="af">Afrikaans</option>
				                                            	<option value="sq">Albanian</option>
				                                            	<option value="ar">Arabic</option>
				                                            	<option value="hy">Armenian</option>
				                                            	<option value="az">Azerbaijani</option>
				                                            	<option value="eu">Basque</option>
				                                            	<option value="be">Belarusian</option>
				                                            	<option value="bn">Bengali</option>
				                                            	<option value="bg">Bulgarian</option>
				                                            	<option value="ca">Catalan</option>
				                                            	<option value="zh-CN">Chinese</option>
				                                            	<option value="hr">Croatian</option>
				                                            	<option value="cs">Czech</option>
				                                            	<option value="da">Danish</option>
				                                            	<option value="nl">Dutch</option>
				                                            	<option value="eo">Esperanto</option>
				                                            	<option value="et">Estonian</option>
				                                            	<option value="tl">Filipino</option>
				                                            	<option value="fi">Finnish</option>
				                                            	<option value="fr">French</option>
				                                            	<option value="gl">Galician</option>
				                                            	<option value="ka">Georgian</option>
				                                            	<option value="de">German</option>
				                                            	<option value="el">Greek</option>
				                                            	<option value="gu">Gujarati</option>
				                                            	<option value="ht">Haitian Creole</option>
				                                            	<option value="iw">Hebrew</option>
				                                            	<option value="hi">Hindi</option>
				                                            	<option value="hu">Hungarian</option>
				                                            	<option value="is">Icelandic</option>
				                                            	<option value="id">Indonesian</option>
				                                            	<option value="ga">Irish</option>
				                                            	<option value="it">Italian</option>
				                                            	<option value="ja">Japanese</option>
				                                            	<option value="kn">Kannada</option>
				                                            	<option value="ko">Korean</option>
				                                            	<option value="la">Latin</option>
				                                            	<option value="lv">Latvian</option>
				                                            	<option value="lt">Lithuanian</option>
				                                            	<option value="mk">Macedonian</option>
				                                            	<option value="ms">Malay</option>
				                                            	<option value="mt">Maltese</option>
				                                            	<option value="no">Norwegian</option>
				                                            	<option value="fa">Persian</option>
				                                            	<option value="pl">Polish</option>
				                                            	<option value="pt">Portuguese</option>
				                                            	<option value="ro">Romanian</option>
				                                            	<option value="ru">Russian</option>
				                                            	<option value="sr">Serbian</option>
				                                            	<option value="sk">Slovak</option>
				                                            	<option value="sl">Slovenian</option>
				                                            	<option value="sw">Swahili</option>
				                                            	<option value="sv">Swedish</option>
				                                            	<option value="ta">Tamil</option>
				                                            	<option value="te">Telugu</option>
				                                            	<option value="th">Thai</option>
				                                            	<option value="tr">Turkish</option>
				                                            	<option value="uk">Ukrainian</option>
				                                            	<option value="ur">Urdu</option>
				                                            	<option value="vi">Vietnamese</option>
				                                            	<option value="cy">Welsh</option>
				                                            	<option value="yi">Yiddish</option>
				                                            </select>
		                                    			</div>
		                                    			<div>
		                                    				<p class="icon-star">Translate the content to the language that you want.</p>
		                                    				<br />
		                                    				<strong>You will lost 1 credit for 1 post</strong>
		                                    			</div>	                                            
		                                        	</div>
		                                        </div>
		                                        <div>
		                                        	<div>
		                                        		<div class="checkbox-group clearafter">
		                                        			<div class="spin">
		                                    					<div>
				                                    				<h3 class="title">Spin title</h3>
				                                    				<div class="clearafter">
				                                    					<label class="col-1"><input class="input type rewriter_title" type="radio" name="rewriter_title" value="no" disabled="disabled" <%=(request.getAttribute("rewriter_title")!=null&&request.getAttribute("rewriter_title").equals("no"))?"checked=\"checked\"":""%> <%=request.getAttribute("rewriter_title")==null?"checked=\"checked\"":"" %>/>&nbsp;&nbsp;No</label>
				                                            			<label class="col-2"><input class="input type rewriter_title" type="radio" name="rewriter_title" value="yes" disabled="disabled" <%=(request.getAttribute("rewriter_title")!=null&&request.getAttribute("rewriter_title").equals("yes"))?"checked=\"checked\"":""%>/>&nbsp;&nbsp;Yes</label>
				                                    				</div>
			                                    				</div>
		                                    				</div>			                                            
			                                            </div>
			                                            <div>
			                                            	<p class="icon-star">Rewrite the post's title</p>
			                                            	<br />
				                                            <p style="color: red;"><strong>This feature will be updated soon</strong></p>
			                                            	<!-- 
			                                            	<br />
			                                            	<strong>You will lost 1 credit for 1 post</strong>
			                                            	<br />
			                                            	Note : This function is only used if your content is English language.
			                                            	<br />
			                                            	If you translate your content to another language, this function can't be used.
			                                            	-->
			                                            </div>
		                                            </div>
		                                        </div>
		                                    </div>
		                                    <div class="category clearafter">
		                                        <div class="left">
		                                            <label>
		                                                <span class="tooltips">
		                                                    <%=category!=null?"Category":"Label" %>                                                
		                                                </span>                          
		                                                <input class="input" type="text" name="category" value="" id="category"/>
		                                                <br />                                            
		                                            </label>
		                                            <p>Type category, each category will be separated with the comma.</p>
													<p>Example : category,category-1,category-2 ... </p>
		                                        </div>
		                                        <%
		                                        if(category!=null)
		                                        {
		                                        	out.print("<ul class=\"right clearafter\">");
		                                        	for(int i=0;i<category.size();i++)
		                                        	{
		                                        %>
		                                             <li><label><input type="checkbox" value="<%=category.get(i) %>" class="checkcategory"/> <%=category.get(i) %></label></li>
		                                        <%
		                                        	}
		                                        	out.print("</ul>");
		                                        }
		                                        %>
		                                    </div>
	                                    </div>
                                    </div>
                                    <div class="preview clearafter" id='preview'>
                                    	<input type="Submit" value="submit" />
                                    	<div style="float: right;">
                                    		<a href="#preview" class="checklinkgetcontent">Preview Article</a>
                                    		<a href="#preview" id="checklinkgetcontenttranslate" style="display: none;">Test translate</a>
	                                    	<a href="#preview" id="checklinkgetcontentspin" style="display: none;">Test spin</a>
                                    	</div>
                                    </div>
                                    <div class="checkresult">
                                    	<p class="content-center">First, <a href="javascript:void(0)" class="checklinkgetcontent">previewing the Article</a> is ok before click Submit Button</p>
                                    </div>
                                </form>
                            </div>
                        </div>                    
                    </div>
                </div>
            </div>
        </div>
<script type="text/javascript" src="/js/addlink.js"></script>   
<script type="text/javascript">
$(document).ready(function(){
	//translate
	if($(".translate:checked").val()=="yes")
	{
		$("#checklinkgetcontenttranslate").css("display","block");
		$("#language").attr("disabled",false);
	} else {
		$("#checklinkgetcontenttranslate").css("display","none");
		$("#language").attr("disabled",true);
	}
	$(".translate").click(function(){
		if($(".translate:checked").val()=="yes")
		{
			$("#checklinkgetcontenttranslate").css("display","block");
			$("#language").attr("disabled",false);
		} else {
			$("#checklinkgetcontenttranslate").css("display","none");
			$("#language").attr("disabled",true);
		}
	});
	
	//spin
	if($(".rewriter_title:checked").val()=="yes")
	{
		$("#checklinkgetcontentspin").css("display","block");
	} else {
		$("#checklinkgetcontentspin").css("display","none");
	}
	$(".rewriter_title").click(function(){
		if($(".rewriter_title:checked").val()=="yes")
		{
			$("#checklinkgetcontentspin").css("display","block");
			$(this).parent().parent().find(".popup").css("display","block");
		} else {
			$("#checklinkgetcontentspin").css("display","none");
			$(this).parent().parent().find(".popup").css("display","none");
		}
	});
	
	//choise sum title
	$("#openchoise").click(function(){
		if($("#advance").css("display")=="none")
		{
			$("#advance").css("display","block");
			$("#openchoise span").removeClass('icon-arrow-down1');
			$("#openchoise span").removeClass('icon-arrow-right1');
			$("#openchoise span").addClass('icon-arrow-down1');
		}
		else{
			$("#advance").css("display","none");
			$("#openchoise span").removeClass('icon-arrow-down1');
			$("#openchoise span").removeClass('icon-arrow-right1');
			$("#openchoise span").addClass('icon-arrow-right1');
		}
	});
	
	
	$("#check-content").click(function(){
		$('html,body').animate({scrollTop: $("#getspecialcontent").offset().top +
			 parseInt($("#getspecialcontent").css('padding-top'),10) },'slow');
		});
	});
	var post='<%=post!=null?true:false%>';
	if(post=='true')
	{
		$('html,body').animate({scrollTop: $("#getspecialcontent").offset().top +
			 parseInt($("#getspecialcontent").css('padding-top'),10) },'slow');
	}
</script>   
<%@ include file='/layout/footer.jsp'%>             